package de.baumann.browser.views.dialog;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;

import de.baumann.browser.R;

public class ExitDialog extends BaseDialog implements View.OnClickListener {
    private View.OnClickListener onExitClickListener;

    public ExitDialog(@NonNull Context context) {
        super(context);
    }

    public void setOnExitClickListener(View.OnClickListener onExitClickListener) {
        this.onExitClickListener = onExitClickListener;
    }

    @Override
    protected int gravity() {
        return Gravity.BOTTOM;
    }

    @Override
    protected int laoutId() {
        return R.layout.dialog_exit;
    }

    @Override
    protected void initView() {
        findViewById(R.id.tvExit).setOnClickListener(this);
        findViewById(R.id.tvExitCancle).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tvExit:
                if (onExitClickListener != null) {
                    onExitClickListener.onClick(v);
                }
                break;
            case R.id.tvExitCancle:
                dismiss();
                break;
            default:
        }
    }
}
